<?php session_start();
require '../common/Utility.php';
require '../db/configuration.php';
require '../crud/CustomSecurity.class.php';
require '../crud/Users.class.php';
loadDB();
isAdmin();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
   "http://www.w3.org/TR/html4/strict.dtd">

<html lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <link rel="stylesheet" type="text/css" href="../css/page.css" />
    <link rel="stylesheet" type="text/css" href="../css/generalProduct.css" />
	<title>categoryNew</title>
	<meta name="generator" content="TextMate http://macromates.com/">
	<meta name="author" content="Димитър Гьормов">
</head>

<body>

<a class="lenta" href="index.php"> Начало </a>

<div id="main">

	<?php
	require '../crud/Category.class.php';
	backAction();
	?>
	
	<form action="categoryNew.php" method="post">
	Category Name: 
	<input type="text" name="category">
	<input class="table-submit add-button" type="submit" value="добави">
	</form>
	
	
	<?php
	
	$crud = new Category(con());
	
	if (isset($_POST['category'])){
		$crud->add($_POST['category'] );
	} else if(isset($_POST['Remove'])) {
		$crud->remove($_POST['id']);
	}
	$tHeaders[0] = "id";
	$tHeaders[1] = "Category Name";
	$tHeaders[2] = "Delete";
	list_table_raw($crud->getAllAdmin(), 'categoryNew.php', $tHeaders, 'Categories');
	?>
</div>
</body>
</html>
